package com.zhangquancheng.shirodemo.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.zhangquancheng.shirodemo.entity.TbUser;
import com.zhangquancheng.shirodemo.mapper.TbUserMapper;
import com.zhangquancheng.shirodemo.service.TbUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Author: zhangquancheng
 * @Description:
 * @Date: 2022/7/14 4:28 下午
 */
@Service
public class TbUserServiceImpl implements TbUserService {
    @Autowired
    TbUserMapper userMapper;

    @Override
    public TbUser queryUserByName(String name) {
        QueryWrapper<TbUser> queryWrapper = new QueryWrapper<>();
        queryWrapper.select().eq("username",name);
        return userMapper.selectOne(queryWrapper);
    }

    @Override
    public int save(TbUser user) {
        return userMapper.insert(user);
    }
}
